const express = require('express')
const cookieParser = require('cookie-parser')

const app = express()
app.use(cookieParser())

app.get('/set-cookie', (req, res) => {
  // res.cookie('name', 'zhangsan')
  res.cookie('name', 'zhangsan', { maxAge: 60 * 1000 })
  res.cookie('theme', 'blue')
  res.send('home')
})

app.get('/remove-cookie', (req, res) => {
  res.clearCookie('name')
  res.send('删除成功....')
})

app.get('/get-cookie', (req, res) => {
  console.log(req.cookies)
  res.send(`欢迎您${req.cookies.name}`)
})

app.listen(3000)
